import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: lenovo
 * Date: 2023 -04 -03
 * Time: 22:03
 */
public class Work {
    public static int[] func(int[] nums){
        int tmp=nums[0];
        for (int i = nums.length-1; i >=0; i--) {
            nums[(i+1)%nums.length]=nums[i%nums.length];
        }
        nums[1]=tmp;
        return nums;
    }

    public static void main(String[] args) {
        int[] nums=new int[]{1,2,3,4,5,6};
        Scanner scanner=new Scanner(System.in);
        int k=scanner.nextInt();
        for (int i = 0; i < k; i++) {
            nums=func(nums);
        }
        System.out.println(Arrays.toString(nums));
    }

   /* public static String func(String str){
        char[] arr=str.toCharArray();
        char tmp=arr[0];
        for (int i = arr.length-1; i >=0; i--) {
            arr[(i+1)%arr.length]=arr[i%arr.length];
        }
        arr[1]=tmp;
        System.out.println(arr);
        return new String(arr);
    }
    public static void main(String[] args) {
        String str="abcdef";
        for (int i = 0; i < 5; i++) {
            str=func(str);
        }
    }*/
}
